# Contributor: Florian Heigl <florian.heigl@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=nvme-cli
pkgver=2.10
pkgrel=1
pkgdesc="NVM-Express user space tooling for Linux"
arch="all"
url="https://github.com/linux-nvme/nvme-cli"
license="GPL-2.0-or-later"
makedepends="
	bash
	json-c-dev
	libnvme-dev
	linux-headers
	meson
	util-linux-dev
	uuidgen
	zlib-dev
	"
checkdepends="
	py3-nose2
	"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-zsh-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/linux-nvme/nvme-cli/archive/v$pkgver.tar.gz
	doc-link.patch
	"
options="!check" # needs pci nvme stuff

build() {
	abuild-meson \
		-Db_lto=true \
		-Ddocs=man \
		-Dudevrulesdir=/usr/lib/udev/rules.d/ \
		-Djson-c=enabled \
		. output
	meson compile -C output
}

check() {
	meson test --print-errorlogs --no-rebuild -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
	rm -rf "$pkgdir"/usr/lib/systemd
}

sha512sums="
e1ce2e3d5990dce6794cc8e2e7a601895ff8474a4ba1c7c1722fab1986ae82bce8d41c18b2b553ffc55b1f3393d716e861acf92ba1262b1576d6e4bfb18ad9d0  nvme-cli-2.10.tar.gz
c18269efc08ddf9cedca8f05d6ac67487af3ac57c869b8452799a24ed9e32804f78a839816cc332e5cc03b7f931fb4fb064370f253126aa71313ae434ca25170  doc-link.patch
"
